package ooday02;

/**父类/超类
 *super指代当前派生类的超类对象
 * 构造派生类之前必须先构造基类
 * 在派生类构造方法中默认先调用基类无参构造方法super()
 */
public class Person {

    String name;
    int age;
    String address;
    Person (){}
    //超类构造方法
    Person (String name,int age,String address){
        this.name=name;
        this.age=age;
        this.address=address;
    }
    void eat(){
        System.out.println(name+"正在吃饭...");
    }
    void sleep(){
        System.out.println(name+"正在睡觉...");
    }
    void sayHi(){
        System.out.println("大家好，我叫"+name+"，今年"+age+"岁了，家住"+address);
    }
}
